package bean

import "TanguyWeb/main/config"

type ResultData struct {
	Code     int32       `json:"code"`
	Msg      string      `json:"msg"`
	DebugMeg string      `json:"debugMeg"`
	Data     interface{} `json:"data"`
}

func (r *ResultData) Error() string {
	return r.Msg
}
func NewResultData(data interface{}) *ResultData {
	return &ResultData{Code: config.OK, Data: data}
}
func NewResultError(code int32, meg string) *ResultData {
	return &ResultData{Code: code, Msg: meg, Data: nil}
}
func (r *ResultData) SetDebugMeg(msg string) *ResultData {
	r.DebugMeg = msg
	return r
}
